<include file="__THEME__/header" />
<link href="http://develop.thinksns.com/sociax_2_0/public/themes/classic/layout.css" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.form.js"></script>
<script type="text/javascript" src="../Public/js/miniblog.js"></script>

<div class="content"><!-- 内容 begin  --> 
  <include file="__THEME__/apps" />
  <div class="main">
    <div class="mainbox">
      <div class="mainbox_R">
        <div class="right_box">
          <h2><a href="#">1小时话题榜</a></h2>
          <ul class="topic_list">
            <li><span class="ol_sz">1</span><a href="#" title="银行收费">银行收费(467)</a></li>
            <li><span class="ol_sz">2</span><a href="#" title="ipad香港上市">ipad香港上市(15660)</a></li>
            <li><span class="ol_sz">3</span><a href="#" title="唐山大地震">唐山大地震(7149)</a></li>
            <li><span class="ol_sz">4</span><a href="#" title="小时候唱过的歌">小时候唱过的歌(27281)</a></li>
            <li><span class="ol_sz">5</span><a href="#" title="世博">世博(32831)</a></li>
            <li><span class="ol_sz">6</span><a href="#" title="新手上路">新手上路(16982)</a></li>
          </ul>
        </div>
        <div class="right_box">
          <h2><a href="#">人气关注榜 TOP10</a></h2>
          <ul class="topic_list">
            <li><span class="ol_sz">1</span><a href="#" title="银行收费">银行收费(467)</a></li>
            <li><span class="ol_sz">2</span><a href="#" title="ipad香港上市">ipad香港上市(15660)</a></li>
            <li><span class="ol_sz">3</span><a href="#" title="唐山大地震">唐山大地震(7149)</a></li>
            <li><span class="ol_sz">4</span><a href="#" title="小时候唱过的歌">小时候唱过的歌(27281)</a></li>
            <li><span class="ol_sz">5</span><a href="#" title="世博">世博(32831)</a></li>
            <li><span class="ol_sz">6</span><a href="#" title="新手上路">新手上路(16982)</a></li>
          </ul>
        </div>
      </div>
      <div class="mainbox_C"> 
        
        <!-- ========== 搜人 begin ============= -->
        <div>
          <div class="cGray2 lh30"  style=" height:30px;">输入朋友的名称或昵称，如：小新</div>
          <div class="Search_bg left">
            <input type="text" class="Text" style="width:400px;" value="" />
            <input class="btn_b" type="button" value="搜索" />
          </div>
          <div class="lh35 clearL"> 搜索"世锦赛~男篮~易建联~王治郅~孙悦~出线"找到 291  位相关用户 </div>
        </div>
        <div class="tab-menu"><!-- 切换标签 begin  -->
          <ul>
            <li><a class="on feed_item" href="###"><span>热门推荐</span></a></li>
          </ul>
        </div>
        <div class="MenuSub"> <a href="#" class="on">全部</a>| <a href="#">同城</a>| <a href="#">关注</a>| <a href="#">原创</a>| <a href="#">文字</a>| <a href="#">图片</a>| <a href="#">视频</a>| <a href="#">高级搜索</a></div>
        <div class="feedBox">
          <ul class="feed_list">
            <li class="lineD_btm" style="width:50%">
            <div class="left" style="width:25px; padding-top:20px;"><input name="" type="checkbox" value="" /></div>
              <div class="userPic"><a title="" href="http://develop.thinksns.com/sociax_2_0/index.php?app=home&amp;mod=space&amp;act=index&amp;uid=5"><img src="/sociax_2_0/data/uploads/avatar/1/small.jpg" card="1"></a></div>
              <div style="margin-left: 95px;" class="feed_c">
                <div style="padding-bottom: 0pt;">
                  <div class="right pr10">
                    <a class="add_atn_small" href="#">加关注</a>
                  </div>
                  <a href="#">兽汰姆</a></div>
                <div style="padding-top: 8px;" class="feed_c_btm lh18">
                  <div>北京，朝阳区</div>
                  <div>SOHO达人</div>
                </div>
              </div>
            </li>
            <li class="lineD_btm" style="width:50%">
            <div class="left" style="width:25px; padding-top:20px;"><input name="" type="checkbox" value="" /></div>
              <div class="userPic"><a title="" href="http://develop.thinksns.com/sociax_2_0/index.php?app=home&amp;mod=space&amp;act=index&amp;uid=5"><img src="/sociax_2_0/data/uploads/avatar/1/small.jpg" card="1"></a></div>
              <div style="margin-left: 95px;" class="feed_c">
                <div style="padding-bottom: 0pt;">
                  <div class="right pr10">
                    <a class="add_atn_small" href="#">加关注</a>
                  </div>
                  <a href="#">兽汰姆</a></div>
                <div style="padding-top: 8px;" class="feed_c_btm lh18">
                  <div>北京，朝阳区</div>
                  <div>SOHO达人</div>
                </div>
              </div>
            </li>
            <li class="lineD_btm" style="width:50%">
            <div class="left" style="width:25px; padding-top:20px;"><input name="" type="checkbox" value="" /></div>
              <div class="userPic"><a title="" href="http://develop.thinksns.com/sociax_2_0/index.php?app=home&amp;mod=space&amp;act=index&amp;uid=5"><img src="/sociax_2_0/data/uploads/avatar/1/small.jpg" card="1"></a></div>
              <div style="margin-left: 95px;" class="feed_c">
                <div style="padding-bottom: 0pt;">
                  <div class="right pr10">
                    <a class="add_atn_small" href="#">加关注</a>
                  </div>
                  <a href="#">兽汰姆</a></div>
                <div style="padding-top: 8px;" class="feed_c_btm lh18">
                  <div>北京，朝阳区</div>
                  <div>SOHO达人</div>
                </div>
              </div>
            </li>
            <li class="lineD_btm" style="width:50%">
            <div class="left" style="width:25px; padding-top:20px;"><input name="" type="checkbox" value="" /></div>
              <div class="userPic"><a title="" href="http://develop.thinksns.com/sociax_2_0/index.php?app=home&amp;mod=space&amp;act=index&amp;uid=5"><img src="/sociax_2_0/data/uploads/avatar/1/small.jpg" card="1"></a></div>
              <div style="margin-left: 95px;" class="feed_c">
                <div style="padding-bottom: 0pt;">
                  <div class="right pr10">
                    <a class="add_atn_small" href="#">加关注</a>
                  </div>
                  <a href="#">兽汰姆</a></div>
                <div style="padding-top: 8px;" class="feed_c_btm lh18">
                  <div>北京，朝阳区</div>
                  <div>SOHO达人</div>
                </div>
              </div>
            </li>
          </ul>
          <div  class="pt10 clearL"><input name="" type="button" class="btn_green_w121" value="关注所选用户" /></div>
        </div>
        <!-- ========== 搜人 end ============= --> 
        
      </div>
    </div>
    <div class="clear"></div>
  </div>
</div>
<!-- 内容 end --> 

<script>
$(document).ready(function(){
	// 发布微博
	$('#miniblog_publish').submit(function() {
		if( $.trim( $('#content_publish').val() ) == '' ){
            alert('内容不能为空');		
			return false;
		}

		textareaStatus('sending');
		
		var options = {
		    success: function(txt) {
		      if(txt){
		    	   delTypeBox();
				   $(".feed_list").prepend( txt ).slideDown('slow');
				   $('#miniblog_publish').clearForm();
				   checkInputLength('#content_publish',140);
		      }else{
                  alert( '发布失败' );
		      }
			}
		};		
		$(this).ajaxSubmit( options );
	    return false;
   });

   $('#content_publish').keyup(function(event){
   		//if(event.shiftKey && event.keyCode==50 ){
			//alert( event.position() );
			//setSearchUser( $(this) );
		//}
   });
   



	//微博字数控制
	checkInputLength('#content_publish',140);
   
});

function setSearchUser(txt){
		reg = /@[^@\s]{1,20}$/g
		var   patt   =   new   RegExp(reg);
		var result = patt.exec( txt.val() );
		var $searchUser = $('#searchUser');
		//var textArea = document.getElementById('content_publish');
		if(result){
			var position = txt.position();
			$searchUser.css({top:position.top+23,left:position.left});
			$searchUser.show();
		}else{
			$searchUser.hide();
		}
}

//检测输入字符数
function checkInputLength(obj,num){
	var str = $(obj).val();
	var $wordNum = $('.wordNum');

	var len = getLength(str);
	if(len==0){
		textareaStatus('off');
		$wordNum.html('你还可以输入<strong id="strconunt">'+ (num-len) + '</strong>字');
	}else if( len > num ){
		$wordNum.css('color','red');
		$wordNum.html('已超出<strong id="strconunt">'+ (len-num) +'</strong>字');
		textareaStatus('off');
	}else if( len <= num ){
		$wordNum.css('color','');
		$wordNum.html('你还可以输入<strong id="strconunt">'+ (num-len) + '</strong>字');
		textareaStatus('on');
	}
}

//发布窗口、按钮状态
function textareaStatus(type){
	var $publish_handle = $('#publish_handle');
	if(type=='on'){
		$publish_handle.removeAttr('disabled')
		$publish_handle.attr('class','btn_big hand');
	}else if( type=='sending'){
		$publish_handle.attr('disabled','true')
		$publish_handle.attr('class','btn_big_disable hand');
	}else{
		$publish_handle.attr('disabled','true');
		$publish_handle.attr('class','btn_big_disable hand');
	}
}

//发布类型
function publish_type_box(type,mg_left){
	var publis_type_html = '';
	var type_num = 0;
	switch(type){
		case 'theme':
			var text = '#请在这里输入自定义话题#';
			var   patt   =   new   RegExp(text,"g");  
			var content_publish = $('#content_publish');
			var result;
						
			if( content_publish.val().search(patt) == '-1' ){
				content_publish.val( content_publish.val() + text);
			}
			
			var textArea = document.getElementById('content_publish');
			
			result = patt.exec( content_publish.val() );
			
			var end = patt.lastIndex-1 ;
			var start = patt.lastIndex - text.length +1;
			
			if (document.selection) { //IE
				 var rng = textArea.createTextRange();
				 rng.collapse(true);
				 rng.moveEnd("character",end)
				 rng.moveStart("character",start)
				 rng.select();
			}else if (textArea.selectionStart || (textArea.selectionStart == '0')) { // Mozilla/Netscape…
		        textArea.selectionStart = start;
		        textArea.selectionEnd = end;
		    }
		    textArea.focus();
			checkInputLength('#content_publish',140);
			return ;
		break;
		
		case 'image':
			type_num = 1;
			publish_type_html = '<div class="btn_green" href="javascript:void(0);">从电脑选择图片'+
								'<form action=\'{:U("miniblog/Operate/uploadpic")}\' enctype="multipart/form-data" method="post" id="uploadpic">'+
								'<input type="file" hidefoucs="true" name="pic" onchange="upload(this)">'+
								'</form></div><div>仅支持JPG、GIF、PNG、JPEG图片文件，且文件小于2M</div>';
		break;
		
		case 'video':
			type_num = 3;
			publish_type_html = '请输入新浪播客、优酷网、土豆网、酷6网等视频网站的视频播放页链接： <div><input name="publish_type_data" type="text" style="width:86%" value="" /></div>';
		break;
		
		
		case 'music':
			type_num = 4;
			publish_type_html = '请输入歌曲链接地址：<div><input name="publish_type_data" type="text" style="width:300px" value="" /></div>';
		break;		
		
	}
	
	$('input[name="publish_type"]').val( type_num );
	
	var html = '<div class="talkPop"><div  style="position: relative; height: 7px; line-height: 3px;">'
		     + '<img class="talkPop_arrow" style="margin-left:'+ mg_left +'px;position:absolute;" src="__THEME__/images/zw_img.gif" /></div>'
             + '<div class="talkPop_box">'
			 + '<div class="close"><a href="javascript:void(0)" class="del" onclick=" delTypeBox()" > </a></div>'
			 + '<div id="publish_type_content">'+publish_type_html+'</div>'
			 + '</div></div>';
	$('div .talkPop').remove();
	$("#publish_type_content_before").after( html );
}
</script> 
<include file="__THEME__/footer" /> 